<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<link rel="stylesheet" href="../../../css/board_style.css" type="text/css">
<link rel="stylesheet" href="../../../css/style.css" type="text/css">
<script type="text/javascript" src="../js/httpRequest.js"></script>
<script language="JavaScript">
	function del(no){
		var c_pwd = f.c_pwd.value;
		if(c_pwd==null || c_pwd==""){
			alert("비밀번호를 입력하세요!!");
			return;
		}
		var param = "b_no="+encodeURIComponent(no)+"&c_pwd="+encodeURIComponent(c_pwd);
		sendRequest("../ajax/check_pwd.jsp", param, resultDelete, "POST");
	}
	function resultDelete(){
		if(xhr.readyState==4 && xhr.status==200){
			var res = eval(xhr.responseText);
			if(res[0].result=="fail"){
				alert("비밀번호가 맞지 않습니다!");
				return;
			}
			if(confirm("삭제 하시겠습니까?")==false)return;
			
			f.action = "board_delete.do";
			f.submit();
		}
	}
	
	
	function modify(no){
		var c_pwd = f.c_pwd.value;
		if(c_pwd==null || c_pwd==""){
			alert("비밀번호를 입력하세요!!");
			return;
		}
		var param = "b_no="+encodeURIComponent(no)+"&c_pwd="+encodeURIComponent(c_pwd);
		sendRequest("../ajax/check_pwd.jsp", param, resultModify, "POST");
    }
	function resultModify(){
		if(xhr.readyState==4 && xhr.status==200){
			var res = eval(xhr.responseText);
			if(res[0].result=="fail"){
				alert("비밀번호가 맞지 않습니다!");
				return;
			}
			f.action = "board_modifyForm.do?state=modify";
			f.submit();
		}
	}
	
	
	
	function reply(){

        document.f.action = "BoardReplyForm.do";

        document.f.submit();

    }
</script>
</HEAD>

<BODY>
<table width="690" height="50" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td><img src="../img/title_04.gif"></td>
	</tr>
</table>

<form name="f" method="post">

<input type="hidden" name="b_no" value="${cvo.b_no }">
<input type="hidden" name="b_subject" value="${cvo.b_subject }">
<input type="hidden" name="b_writer" value="${cvo.b_writer }">
<input type="hidden" name="b_filename" value="${cvo.b_filename }">
<input type="hidden" name="b_content" value="${cvo.b_content }">
<input type="hidden" name="menu_no" value="${cvo.menu_no }">
<input type="hidden" name="cate_no" value="${cvo.cate_no }">
<input type="hidden" name="title_no" value="${cvo.title_no }">

<%-- <input type="hidden" name="page" value=${param.page }> --%>
<table width="690" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="120" height="25" class="td_d">제목</td>
		<td class="td_d_1">${cvo.b_subject }</td>
	</tr>
	<tr>
		<td width="120" height="25" class="td_d_4">작성자</td>
		<td class="td_d_2">${cvo.b_writer }</td>
	</tr>
	<tr>
		<td width="120" height="25" class="td_d_4">작성일</td>
		<td class="td_d_2">${cvo.b_writedate }</td>
	</tr>
<c:if test="${cvo.b_filename!='no_file' }">	
	<tr>
		<td width="120" height="25" class="td_d_4">첨부파일</td>
		<td class="td_d_2">${cvo.b_filename }
			<input type="button" value="다운로드" onclick="download('${cvo.b_filename}')">
		</td>
	</tr>
</c:if>
<c:if test="${cvo.b_filename eq 'no_file' }">	
	<tr>
		<td width="120" height="25" class="td_d_4">첨부파일</td>
		<td class="td_d_2">첨부파일이 존재하지 않습니다.</td>
	</tr>
</c:if>		
	<tr>
		<td width="120" class="td_d_4">내용</td>
		<td class="td_d_3" width="570" 
style="word-wrap:break-word;word-break:break-all">
			<pre>${cvo.b_content }</pre>
		</td>
	</tr>
	<tr>
		<td height="25" class="td_d_4">비밀번호</td>
		<td class="td_d_3" colspan="3">
		<input name="c_pwd" type="password" class="search" style="width:70px;"></td>
	</tr>     	
</table>

<table width="690" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="5"></td>
	</tr>
	<tr>
		<td><img src="../img/btn_list.gif" onClick="javaScript:location.href='../main/community_main.do?menu_no=${menu_no }&cate_no=${cate_no }'" style="cursor:hand">
		<img src="../img/btn_reply.gif" onClick="reply()" style="cursor:hand">

		<img src="../img/btn_modify.gif" onClick="modify('${cvo.b_no }')" style="cursor:hand">

		<!-- <img src="../img/btn_delete.gif" alt="답변 또는 댓글이 있을 경우 삭제가 되지 않습니다."> -->
<img src='../img/btn_delete.gif' onClick="del('${cvo.b_no }')" style='cursor:hand'>
		</td>
	</tr>
</table>
</form>

<p><br>


</BODY>
</HTML>